// +---------------------
// | 设备接入
// +---------------------
import config from "@/common/config";
import { request } from "@/common/request";
import store from "@/store";
import { Md5 } from "ts-md5";

/** 人脸消息推送 */
export function iotPush(data: any) {
  return request({
    url: "/kingon-device/healthData/iotPush?notVerify=1",
    method: "post",
    data: data,
    header: {
      appid: config.iotAppid,
      token: Md5.hashStr(store.getters.deviceId),
    },
  });
}

/** 获取设备设置参数 */
export function deviceSetting(deviceCode: string) {
  return request({
    url: "/kingon-device/health/deviceSetting/detail",
    method: "get",
    params: {
      deviceCode,
      deviceSettingContentId: 44,
    },
    header: {
      ['device-code']: deviceCode,
    },
  });
}

/**
 * 查询设备是否绑定 （目前使用查询列表，根据设备id对比绑定账号）
 */
export function deviceDetail(deviceCode: string) {
  return request({
    url: "/kingon-device/health/device/list",
    method: "get",
    params: {
      deviceCode,
      deviceType: 5,
      serverName:'kingon-customer',
      current: 1,
      size: 10,
    }
  });
}

/**
 * 触发网络打印机打印
 */
export function netPrinterPrinting(buffetOrderId: string) {
  return request({
    url: "/kingon-service-order/kingon-warehousesupplier/buffetOrder/print",
    method: "get",
    params: {
      buffetOrderId,
    }
  });
}
